<template>
<el-row :gutter="20" id="app" v-cloak>
	<el-col :span="12">
		<el-form ref="form" :model="info" label-width="100px" size="mini" style="padding:10px">
		  <el-form-item label="卡名称">
		    <el-input v-model="info.name" disabled></el-input>
		  </el-form-item>

		  <el-form-item label="卡编号">
		    <el-input v-model="info.number" disabled></el-input>
		  </el-form-item>

		  <el-form-item label="卡类型">
		    <el-input v-model="info.type" disabled></el-input>
		  </el-form-item>

		  <el-form-item label="卡价格">
		    <el-input v-model="info.price" disabled></el-input>
		  </el-form-item>

		  <el-form-item label="有效期"  v-if="info.category == 1">
		    <el-input v-model="info.validity" disabled></el-input>
		  </el-form-item>

		  <el-form-item label="百分比提成" v-if="info.tdtype==1">
		    <el-input v-model="info.percent" disabled></el-input>
		  </el-form-item>

		  <el-form-item label="固定金额提成" v-else>
		    <el-input v-model="info.fixed" disabled></el-input>
		  </el-form-item>

		  <el-form-item label="卡描述">
		    <el-input type="textarea" v-model="info.remarks" disabled></el-input>
		  </el-form-item>
		</el-form>

	</el-col>
	<el-col :span="12">
		<el-table :data="list" :stripe="true" height="400">
			<el-table-column prop="name" label="项目"></el-table-column>
			<el-table-column prop="number" label="编号"></el-table-column>
			<el-table-column prop="price" label="原价"></el-table-column>
			<el-table-column prop="disprice" label="折扣价" v-if="info.category==2"></el-table-column>
			<el-table-column prop="num" label="数量" v-if="info.category==2"></el-table-column>
		</el-table>
	</el-col>
</el-row>
</template>
<script>
import C from '#/src/common/common.js'

export default {
    name: 'cardInfo',
    data () {
        return {
            info: {},
            list: [],
        }
    },
    mounted: async function(){
        let id = C.getDatas().id
        let res = await C.ajax('/shop/card/lookcardinfo', {id: id})
        if (res) {
            res.info.type = res.info.category===1?'期卡':'疗程卡'
            res.info.percent = Number(res.info.percent*100).toFixed(2)+'%'
            res.info.fixed = res.info.fixed+'元'
            this.info = res.info
            this.list = res.list
        }
    }
}
</script>